<template>
  <div class="components-title-bar">
    <div class="has-tooltip">
      <span>{{ title }}</span>
      <el-popover
        placement="top"
        width="300"
        trigger="hover"
        :content="tipsContent"
      >
        <template #reference>
          <el-button class="tit-mod-btn">
            <div class="que-mark">
              ?
            </div>
          </el-button>
        </template>
      </el-popover>
    </div>
    <div class="export-btn">
      <div
        v-if="showExport"
        class="default-btn primary-btn"
        @click="exportCategory()"
      >
        {{ $t("order.export") }}
      </div>
    </div>
  </div>
</template>

<script setup>
defineProps({
  title: {
    type: String,
    default: '标题'
  },
  tipsContent: {
    type: String,
    default: '内容'
  },
  showExport: {
    type: Boolean,
    default: false
  }
})
const emit = defineEmits(['export'])
const exportCategory = () => {
  emit('export')
}
</script>

<style lang="scss" scoped>
.components-title-bar{
  line-height: 18px;
  padding: 18px 12px;
  margin: 0.5em 0 1em 0;
  position: relative;
  .has-tooltip {
    display: flex;
    align-items: center;
    span {
      line-height: 18px;
      font-size: 18px;
      color: #333;
      font-weight: bold;
      margin-right: 5px;
    }
    .tit-mod-btn {
      width: auto;
      height: auto;
      padding: 0;
      border: none;
    }
    .tit-mod-btn:hover, .tit-mod-btn:focus {
      color: #333;
      background-color: transparent;
    }
    // 文字提示框的问号icon
    .que-mark {
      display: inline-block;
      width: 14px;
      height: 14px;
      line-height: 14px;
      font-size: 12px;
      text-align: center;
      color: #fff;
      background: #C8C9CC;
      border-radius: 50%;
      margin-left: 5px;
      cursor: default;
    }
  }
  .export-btn {
    position: absolute;
    right: 0;
    top: 18px;
  }
}

</style>
